\(\int \frac {\cos (x)}{\cot (x)+\csc (x)} \, dx\) [204]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [A] (verified)
   Fricas [A] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [A] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 10, antiderivative size = 10 \[ \int \frac {\cos (x)}{\cot (x)+\csc (x)} \, dx=-\cos (x)+\log (1+\cos (x)) \]

[Out]

-cos(x)+ln(1+cos(x))

Rubi [A] (verified)

Time = 0.08 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.300, Rules used = {4477, 2912, 45} \[ \int \frac {\cos (x)}{\cot (x)+\csc (x)} \, dx=\log (\cos (x)+1)-\cos (x) \]

[In]

Int[Cos[x]/(Cot[x] + Csc[x]),x]

[Out]

-Cos[x] + Log[1 + Cos[x]]

Rule 45

Int[((a_.) + (b_.)*(x_))^(m_.)*((c_.) + (d_.)*(x_))^(n_.), x_Symbol] :> Int[ExpandIntegrand[(a + b*x)^m*(c + d
*x)^n, x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[b*c - a*d, 0] && IGtQ[m, 0] && ( !IntegerQ[n] || (EqQ[c, 0]
&& LeQ[7*m + 4*n + 4, 0]) || LtQ[9*m + 5*(n + 1), 0] || GtQ[m + n + 2, 0])

Rule 2912

Int[cos[(e_.) + (f_.)*(x_)]*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)
])^(n_.), x_Symbol] :> Dist[1/(b*f), Subst[Int[(a + x)^m*(c + (d/b)*x)^n, x], x, b*Sin[e + f*x]], x] /; FreeQ[
{a, b, c, d, e, f, m, n}, x]

Rule 4477

Int[(cot[(c_.) + (d_.)*(x_)]^(n_.)*(a_.) + csc[(c_.) + (d_.)*(x_)]^(n_.)*(b_.))^(p_)*(u_.), x_Symbol] :> Int[A
ctivateTrig[u]*Csc[c + d*x]^(n*p)*(b + a*Cos[c + d*x]^n)^p, x] /; FreeQ[{a, b, c, d}, x] && IntegersQ[n, p]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\cos (x) \sin (x)}{1+\cos (x)} \, dx \\ & = -\text {Subst}\left (\int \frac {x}{1+x} \, dx,x,\cos (x)\right ) \\ & = -\text {Subst}\left (\int \left (1+\frac {1}{-1-x}\right ) \, dx,x,\cos (x)\right ) \\ & = -\cos (x)+\log (1+\cos (x)) \\ \end{align*}

Mathematica [A] (verified)

Time = 0.02 (sec) , antiderivative size = 20, normalized size of antiderivative = 2.00 \[ \int \frac {\cos (x)}{\cot (x)+\csc (x)} \, dx=-2 \cos ^2\left (\frac {x}{2}\right )+2 \log \left (\cos \left (\frac {x}{2}\right )\right ) \]

[In]

Integrate[Cos[x]/(Cot[x] + Csc[x]),x]

[Out]

-2*Cos[x/2]^2 + 2*Log[Cos[x/2]]

Maple [A] (verified)

Time = 1.24 (sec) , antiderivative size = 11, normalized size of antiderivative = 1.10

method result size
derivativedivides \(-\cos \left (x \right )+\ln \left (\cos \left (x \right )+1\right )\) \(11\)
default \(-\cos \left (x \right )+\ln \left (\cos \left (x \right )+1\right )\) \(11\)
risch \(-i x -\frac {{\mathrm e}^{i x}}{2}-\frac {{\mathrm e}^{-i x}}{2}+2 \ln \left ({\mathrm e}^{i x}+1\right )\) \(30\)

[In]

int(cos(x)/(cot(x)+csc(x)),x,method=_RETURNVERBOSE)

[Out]

-cos(x)+ln(cos(x)+1)

Fricas [A] (verification not implemented)

none

Time = 0.25 (sec) , antiderivative size = 12, normalized size of antiderivative = 1.20 \[ \int \frac {\cos (x)}{\cot (x)+\csc (x)} \, dx=-\cos \left (x\right ) + \log \left (\frac {1}{2} \, \cos \left (x\right ) + \frac {1}{2}\right ) \]

[In]

integrate(cos(x)/(cot(x)+csc(x)),x, algorithm="fricas")

[Out]

-cos(x) + log(1/2*cos(x) + 1/2)

Sympy [F]

\[ \int \frac {\cos (x)}{\cot (x)+\csc (x)} \, dx=\int \frac {\cos {\left (x \right )}}{\cot {\left (x \right )} + \csc {\left (x \right )}}\, dx \]

[In]

integrate(cos(x)/(cot(x)+csc(x)),x)

[Out]

Integral(cos(x)/(cot(x) + csc(x)), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 34 vs. \(2 (10) = 20\).

Time = 0.30 (sec) , antiderivative size = 34, normalized size of antiderivative = 3.40 \[ \int \frac {\cos (x)}{\cot (x)+\csc (x)} \, dx=-\frac {2}{\frac {\sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} + 1} - \log \left (\frac {\sin \left (x\right )^{2}}{{\left (\cos \left (x\right ) + 1\right )}^{2}} + 1\right ) \]

[In]

integrate(cos(x)/(cot(x)+csc(x)),x, algorithm="maxima")

[Out]

-2/(sin(x)^2/(cos(x) + 1)^2 + 1) - log(sin(x)^2/(cos(x) + 1)^2 + 1)

Giac [A] (verification not implemented)

none

Time = 0.28 (sec) , antiderivative size = 10, normalized size of antiderivative = 1.00 \[ \int \frac {\cos (x)}{\cot (x)+\csc (x)} \, dx=-\cos \left (x\right ) + \log \left (\cos \left (x\right ) + 1\right ) \]

[In]

integrate(cos(x)/(cot(x)+csc(x)),x, algorithm="giac")

[Out]

-cos(x) + log(cos(x) + 1)

Mupad [B] (verification not implemented)

Time = 23.60 (sec) , antiderivative size = 24, normalized size of antiderivative = 2.40 \[ \int \frac {\cos (x)}{\cot (x)+\csc (x)} \, dx=-\ln \left ({\mathrm {tan}\left (\frac {x}{2}\right )}^2+1\right )-\frac {2}{{\mathrm {tan}\left (\frac {x}{2}\right )}^2+1} \]

[In]

int(cos(x)/(cot(x) + 1/sin(x)),x)

[Out]

- log(tan(x/2)^2 + 1) - 2/(tan(x/2)^2 + 1)